import request from "../http";
import requestAll from "../httpAll";
let hostqt = '/mobile' //测试环境
export default hostqt

// 服务市场首页
// 查询服务机构入驻流程
export function getquerySettledProcess(data) {
  return requestAll({
    url: `${hostqt}/commerce/agency/querySettledProcess`,
    method: "POST",
    data
  });
}

// 判断服务机构是否入驻
export function getcheckHasSettled(data) {
  return requestAll({
    url: `${hostqt}/commerce/agency/checkHasSettled`,
    method: "POST",
    data
  });
}

// 获取企业基本信息
export function getprofile(){
  return request({
    url: `/company/profile`,
    method: "GET"
  });
}

// 已入驻的商家列表
export function getquerySettledAgency(data){
  return requestAll({
    url: `${hostqt}/commerce/agency/querySettledAgency`,
    method: "POST",
    data
  });
}

// 服务需求列表
export function getqserviceRequirement(data){
  return requestAll({
    url: `${hostqt}/serviceRequirement/list`,
    method: "POST",
    data
  });
}

// 商家详情页
// 获取商家详情
export function getProductDetail(data){
  return requestAll({
    url: `${hostqt}/commerce/agency/queryAgencyDetail`,
    method: "POST",
    data
  });
}

// 需求广场详情
export function onDetailed(id){
  return requestAll({
    url: `${hostqt}/serviceRequirement/detail/${id}`,
    method: "GET",
  });
}

// 服务机构入驻
// 提交入驻接口
export function getsettled(data){
  return requestAll({
    url: `${hostqt}/commerce/agency/settled`,
    method: "POST",
    data
  });
}

// 获取地区数据
export function getArea(){
  return request({
    url: `/system/region/tree`,
    method: "GET"
  });
}

// 查询1级类目列表
export function getqueryList(){
  return requestAll({
    url: `${hostqt}/ecomm/category/queryList?tenantId=1&parentId=0`,
    method: "POST"
  });
}

// qt上传 
export function customUpload(data,file){
  return requestAll({
    url: `${hostqt}/commerce/comment/uploadFile`,
    method: "POST",
    data,
    onUploadProgress: (progressEvent) => {
        console.log('progressEvent', progressEvent)
        console.log('file', file)
        let num = progressEvent.loaded / progressEvent.total * 100 | 0;  //百分比
        file.onProgress({percent: num})     //进度条
    }
  });
}
